import { createSlice } from "@reduxjs/toolkit";

const riderListSlice = createSlice({
  name: "riderListSlice",
  initialState: [
    {
      id: 1,
      name: "张三",
      phone: "186000000000",
      certificate: "11011120001010000X",
      status: true,
    },
    {
      id: 2,
      name: "李四",
      phone: "186000000001",
      certificate: "11011120001010000X",
      status: true,
    },
    {
      id: 3,
      name: "王五",
      phone: "186000000002",
      certificate: "11011120001010000X",
      status: true,
    },
    {
      id: 4,
      name: "赵六",
      phone: "186000000003",
      certificate: "11011120001010000X",
      status: true,
    },
  ],
  reducers: {
    updateRiderList(state, { payload }) {
      state[payload.index].status = payload.checked;
    },
  },
});

export const { updateRiderList, addRiderList, delRiderList, editRiderList } =
  riderListSlice.actions;
export default riderListSlice.reducer;
